﻿#region License
/*

	Copyright (C) 2008 Oliver Charles, Daniel Hollander

	This program is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program.  If not, see <http://www.gnu.org/licenses/>.
	
*/
#endregion

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;

namespace Moebius.Hud
{
    /// <summary>
    /// Represents a heads-up-display, that is used to convey information to the player on screen.
    /// </summary>
    public abstract class HeadsUpDisplay
    {
        #region Properties

        private readonly List<TextDisplay> mTexts = new List<TextDisplay>();

        /// <summary>
        /// Gets all <see cref="TextDisplay"/>s bound to this heads-up-display
        /// </summary>
        protected ReadOnlyCollection<TextDisplay> Texts
        {
            get { return mTexts.AsReadOnly(); }
        }

        #endregion

        #region Load Font

        /// <summary>
        /// Load a font on this heads up display
        /// </summary>
        /// <param name="settings">Settings of the font to load</param>
        /// <returns>A <see cref="Font"/> instance, bound to this heads up display</returns>
        /// <seealso cref="FontSettings"/>
        public abstract Font LoadFont(FontSettings settings);

        #endregion

        #region Attach Text

        /// <summary>
        /// Attaches some text the <see cref="HeadsUpDisplay"/>
        /// </summary>
        /// <param name="text">A <see cref="TextDisplay"/> instance to attach</param>
        public void AttachText(TextDisplay text)
        {
            if (text == null) throw new ArgumentNullException("text");

            mTexts.Add(text);
        }

        #endregion

        #region Render

        /// <summary>
        /// Render the heads-up-display
        /// </summary>
        public abstract void Render();

        #endregion
    }
}